package com.xiaoyi.sports.service.impl;

import java.util.List;

import com.xiaoyi.common.exception.BizException;
import com.xiaoyi.common.service.AbsService;
import com.xiaoyi.sports.data.entity.UserInfo;
import com.xiaoyi.sports.data.entity.UserInfoExample;
import com.xiaoyi.sports.data.mapper.UserInfoMapper;
import com.xiaoyi.sports.service.intface.IUserInfoService;
import com.xiaoyi.sports.service.convert.UserInfoPOConvertor;
import com.xiaoyi.sports.service.dto.CreateUserInfoReqTO;
import com.xiaoyi.sports.service.dto.CreateUserInfoResTO;
import com.xiaoyi.sports.service.dto.DeleteUserInfoReqTO;
import com.xiaoyi.sports.service.dto.DeleteUserInfoResTO;
import com.xiaoyi.sports.service.dto.ModifyUserInfoReqTO;
import com.xiaoyi.sports.service.dto.ModifyUserInfoResTO;
import com.xiaoyi.sports.service.dto.QueryUserInfoReqTO;
import com.xiaoyi.sports.service.dto.QueryUserInfoResTO;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service(value = "genericDAOService")
@Transactional //写Service Spring会扫描到 并处理 加上Transactional 事务管理
public class UserInfoServiceImpl implements IUserInfoService {
	@Override
	public CreateUserInfoResTO createSample(CreateUserInfoReqTO req) throws BizException {
		return null;
	}

	@Override
	public ModifyUserInfoResTO modifySample(ModifyUserInfoReqTO req) throws BizException {
		return null;
	}

	@Override
	public DeleteUserInfoResTO deleteSample(DeleteUserInfoReqTO req) throws BizException {
		return null;
	}

	@Override
	public QueryUserInfoResTO querySample(QueryUserInfoReqTO req) throws BizException {
		return null;
	}

//	@Autowired
	/*UserInfoMapper userInfoMapper;


	@Override
	public CreateUserInfoResTO createSample(CreateUserInfoReqTO req) throws BizException{
		CreateUserInfoResTO res = new CreateUserInfoResTO();
		
		UserInfo entity = UserInfoPOConvertor.convertCreateSampleDO(req);
		userInfoMapper.insert(entity);
		
		return res;
	}

	@Override
	public ModifyUserInfoResTO modifySample(ModifyUserInfoReqTO req) throws BizException{
		ModifyUserInfoResTO res = new ModifyUserInfoResTO();
		UserInfo condition = UserInfoPOConvertor.convertModifySampleDO(req);
		userInfoMapper.updateByPrimaryKey(condition);
		
		return res;
	}

	@Override
	public DeleteUserInfoResTO deleteSample(DeleteUserInfoReqTO req) throws BizException{
		DeleteUserInfoResTO res = new DeleteUserInfoResTO();
		UserInfoExample condition = UserInfoPOConvertor.convertDeleteSampleDO(req);
		userInfoMapper.deleteByExample(condition);
		
		return res;
	}

	@Override
	public QueryUserInfoResTO querySample(QueryUserInfoReqTO req) throws BizException{
		UserInfoExample condition = UserInfoPOConvertor.convertQuerySampleDO(req);
		List<UserInfo> dos = userInfoMapper.selectByExample(condition);
		QueryUserInfoResTO res = UserInfoPOConvertor.convertQuerySampleTO(dos);
		
		return res;
	}
	*/
	
}
